package com.simple.datax.db.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.dubbo.common.logger.Logger;
import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.simple.datax.db.mybatis.client.DataxSystemLogMapper;
import com.simple.datax.db.mybatis.model.DataxSystemLog;
import com.simple.datax.service.DBSystemLogService;

/**
 * @Title: DBSystemLogServiceImpl.java
 * @Package com.simple.datax.db.service.impl
 * @Description: 记数据库日志操作。
 * @author Paladin Chen
 * @date 2012-12-21 下午6:17:20
 * @version V1.0
 */
@Service("dbLogService")
public class DBSystemLogServiceImpl implements DBSystemLogService {
	private static final Logger logger = LoggerFactory
			.getLogger(DBSystemLogServiceImpl.class);

	@Autowired
	private DataxSystemLogMapper dslm;

	@Override
	public void insertLog(String logThread, String actionName, String logLevel,
			String logContent) {
		try {
			DataxSystemLog dsl = new DataxSystemLog();
			dsl.setActionName(actionName);
			dsl.setLogContent(logContent);
			dsl.setLogLevel(logLevel);
			dsl.setLogThread(logThread);

			dslm.insert(dsl);

		} catch (Exception e) {
			logger.error("Insert SystemLog Error:", e);
		}

	}

}
